function settle_clk(){
	var cust_id=document.indexForm.cust_id.value;
	if(cust_id==""){
		alert("请选择需要结算的区域代理商");
		return false;
	}
	document.indexForm.action='/doTradeReg.do';
	document.indexForm.submit();
}

function tijiao(cust_id,index) {

	document.getElementById('backMessage'+index).innerHTML = '<img src="/program/admin/images/wait.gif"/>正在更新，请稍等...';
	 
 	 jQuery.ajax({
		   type: 'POST',
		   url: '/program/admin/updateCustWeb/createHtml.jsp',
		   data: 'cust_id='+cust_id+'&limit=1',
		   success: function(msg){
		   	 	document.getElementById('backMessage'+index).innerHTML = msg;
			 }
		});
}
function subForm(){
	
	if(document.getElementById('cust_id').value==""){
		alert("请选择会员");
		return false;
	}
	if(document.getElementById('start_date').value==""){
		alert("请选择开始时间");
		return false;
	}
	if(document.getElementById('end_date').value==""){
		alert("请选择结束时间");
		return false;
	}
	document.addForm.submit();
} 
 function showLinkCompany(){
   var gURL = "/program/admin/agentbiz/showMoreCompany.jsp?height=400&width=500";  
   var title ="企业会员";  
   TB_show(title,gURL,true); 
}  
function linkCompanyOpr(cust_id,cust_name,area_attr)
{
		var req_url="cust_id="+cust_id+"&cust_name="+encodeURI(encodeURI(cust_name))+"&area_attr="+area_attr;
		document.location.href="/program/admin/agentbiz/addInfo.jsp?"+req_url;
		TB_remove();
} 
/*
function searcher(){
		document.indexForm.submit();
	}*/
function searcher(){
  	var area_attr = "";
	if(document.getElementById("province").value!=""){
		area_attr += document.getElementById("province").value + "|";
	}
	if(document.getElementById("eparchy_code").value!="" ){
		area_attr += document.getElementById("eparchy_code").value + "|";
	}
	
	if(document.getElementById("city_code").value!="" ){
		area_attr += document.getElementById("city_code").value + "|";
	}
	document.indexForm.area_attr.value = area_attr;
	document.indexForm.submit();
}



	

function judgeCheck()
{
    var pkid_string = '';
		var listsize = document.getElementById('listsize').value;
		for(var i=0;i<listsize;i++)
		{
				if(document.getElementById('checkone'+i).checked)
				{
					pkid_string += document.getElementById('checkone'+i).value+'|';
				}
		}
    return pkid_string;
}	


function changeTime(){

	var obj = document.getElementById('up_operating').value;
	if( obj == '' || obj.indexOf('-')>-1 || obj.indexOf('c')>-1 || obj.indexOf('d')>-1 ){
		document.getElementById('b_g').style.display = 'none';
	}else{
		document.getElementById('b_g').style.display = 'inline';
	}
}

function operateInfo(val){

	var oper = document.getElementById(val+'_operating').value;
	if(oper == ''){
		alert('请选择操作方式!');
		return false;
	}

	var listsize = document.getElementById('listsize').value;

	var pkid_string = judgeCheck();
	if( pkid_string == '' ){
		alert('请至少选择一个会员进行操作!');
		return false;
	}
	if( oper == '-' ){
		document.getElementById('pkid').value = pkid_string;
		document.indexForm.action = '/doTradeReg.do';
		document.getElementById('bpm_id').value = '5779';
		if(window.confirm('确认删除吗?')){
			document.indexForm.submit();
		}
 	} else if( 'abcd'.indexOf(oper) > -1 ) {
		document.getElementById('pkid').value = pkid_string;
		document.indexForm.action='/doTradeReg.do';
		document.getElementById('bpm_id').value = '8342';
		if(window.confirm('确认提交吗?')){
			document.indexForm.submit();
		}
	} else {
		document.getElementById('pkid').value = pkid_string;
		document.indexForm.action='/doTradeReg.do';
		document.getElementById('bpm_id').value = '2491';
		if(window.confirm('确认提交吗?')){
			document.indexForm.submit();
		}
	}

}


function deleteOneInfo(pkid,bpm_id)
{

	if(window.confirm('确认删除吗？'))
	{
	  window.location.href='/doTradeReg.do?pkid='+pkid+'&bpm_id='+bpm_id;
 	}
}



function setstartProvince(val)
{
	Ts_areaInfo.getAreaClassByUpId('000000000000000',function(data){
		DWRUtil.removeAllOptions(val+'province');
		DWRUtil.addOptions(val+'province',{'':'请选择'});
		DWRUtil.addOptions(val+'province',data);
	})
}

function setCitys(prov,val)
{var provence=prov;
	 Ts_areaInfo.getAreaClassByUpId(provence,function(data){
		DWRUtil.removeAllOptions(val+'eparchy_code');
		DWRUtil.addOptions(val+'eparchy_code',{'':'请选择'});
		DWRUtil.addOptions(val+'eparchy_code',data);
		DWRUtil.removeAllOptions(val+'city_code');
		DWRUtil.addOptions(val+'city_code',{'':'请选择'});
	});
}

function setAreas(city_id,val){
	Ts_areaInfo.getAreaClassByUpId(city_id,function(data){
	 	DWRUtil.removeAllOptions(val+'city_code');
		DWRUtil.addOptions(val+'city_code',{'':'请选择'});
	 	DWRUtil.addOptions(val+'city_code',data);
	});
}